package com.cbhb.sys;

public class NumberOfSteps {

    public static int numberOfSteps(int num) {
        if (num == 0) return 0;
        int step = 0;
        while(num > 0) {
            if (num % 2 == 1) {
                num -= 1;
            } else {
                num /= 2;
            }
            step ++;
        }
        return step;
    }

    public static void main(String[] args) {
        System.out.println(numberOfSteps(123));
    }
}
